package com.kly.cashmall.services.interceptor;



import com.kly.cashmall.AppApplication;
import com.kly.cashmall.base.ParamsBuilder;
import com.kly.cashmall.services.Params;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
 * @author zxp
 * @version $Id$
 * @since 2018/9/24 20:08
 */
public class HeaderInterceptor implements Interceptor {
    @Override
    public Response intercept(Chain chain) throws IOException {
        Request original = chain.request();
        Request request = original.newBuilder()
                .header("basicParams", ParamsBuilder.create(new Params(), AppApplication.getInstance()))
                .method(original.method(), original.body())
                .build();
        return chain.proceed(request);

    }
}
